package com.wzu.rjgc_ks.controller;

import com.wzu.rjgc_ks.dao.CompanyMapper;
import com.wzu.rjgc_ks.pojo.Company;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;

@Controller
public class RegisterAction {
    @Autowired
    CompanyMapper companyMapper;

    @RequestMapping("/register")
    public ModelAndView register(@RequestParam("Com_account")String Com_account,@RequestParam("Com_password")String Com_password,
                                 @RequestParam("Com_phone")String Com_phone){
        ModelAndView mv = new ModelAndView();

        Company company = new Company();
        company.setComAccount(Com_account);
        company.setComPassword(Com_password);
        company.setComPhone(Com_phone);

        companyMapper.insert(company);

        mv.setViewName("index");
        return mv;
    }
}
